import React, { Component } from 'react'
export default class App extends Component { 
  state = {isHot:true}
  handleShow = ()=>{
    alert(this.input.value)
  }
  show=(currentNode)=>{
    this.input = currentNode
  }
  render() {
    return (
      <div>
        <h2>今天天气{this.state.isHot?"炎热":"凉爽"}</h2>
        <button onClick={()=>{this.setState({isHot:!this.state.isHot})}}>点击切换天气</button><br></br>
        {/* 内联式 <input ref={el=>{this.input1=el;console.log(el);}}/> */}
        class绑定式<input ref={this.show}/>
        <button onClick={this.handleShow}>点击获取左侧input信息</button>
      </div>
    )
  }
}
